<template>
  <div class="app-container">
    <!-- 顶部统计卡片 -->
    <div class="stats-cards">
      <el-row :gutter="20">
        <el-col :span="6">
          <div class="stat-card">
            <div class="stat-icon">
              <i class="el-icon-cpu"></i>
            </div>
            <div class="stat-content">
              <div class="stat-number">{{ stats.totalSubmissions }}</div>
              <div class="stat-label">总提交数</div>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="stat-card">
            <div class="stat-icon success">
              <i class="el-icon-check"></i>
            </div>
            <div class="stat-content">
              <div class="stat-number">{{ stats.acceptedSubmissions }}</div>
              <div class="stat-label">通过数</div>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="stat-card">
            <div class="stat-icon warning">
              <i class="el-icon-close"></i>
            </div>
            <div class="stat-content">
              <div class="stat-number">{{ stats.failedSubmissions }}</div>
              <div class="stat-label">失败数</div>
            </div>
          </div>
        </el-col>
        <el-col :span="6">
          <div class="stat-card">
            <div class="stat-icon info">
              <i class="el-icon-time"></i>
            </div>
            <div class="stat-content">
              <div class="stat-number">{{ stats.avgScore }}</div>
              <div class="stat-label">平均分</div>
            </div>
          </div>
        </el-col>
      </el-row>
    </div>

    <!-- 查询表单区域 -->
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px" class="search-form">
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="学生ID" prop="studentId">
            <el-input
              v-model="queryParams.studentId"
              placeholder="请输入学生ID"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="OJ题目ID" prop="ojProblemId">
            <el-input
              v-model="queryParams.ojProblemId"
              placeholder="请输入OJ题目ID"
              clearable
              @keyup.enter.native="handleQuery"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="编程语言" prop="programmingLanguage">
            <el-select v-model="queryParams.programmingLanguage" placeholder="请选择编程语言" clearable>
              <el-option label="C++" value="cpp"></el-option>
              <el-option label="Java" value="java"></el-option>
              <el-option label="Python" value="python"></el-option>
              <el-option label="JavaScript" value="javascript"></el-option>
              <el-option label="C" value="c"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="编译状态" prop="compileStatus">
            <el-select v-model="queryParams.compileStatus" placeholder="请选择编译状态" clearable>
              <el-option label="编译成功" value="success"></el-option>
              <el-option label="编译失败" value="failed"></el-option>
              <el-option label="编译中" value="compiling"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="20">
        <el-col :span="6">
          <el-form-item label="执行状态" prop="executionStatus">
            <el-select v-model="queryParams.executionStatus" placeholder="请选择执行状态" clearable>
              <el-option label="执行成功" value="success"></el-option>
              <el-option label="执行失败" value="failed"></el-option>
              <el-option label="执行中" value="running"></el-option>
              <el-option label="超时" value="timeout"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="提交时间" prop="submissionTime">
            <el-date-picker
              v-model="queryParams.submissionTime"
              type="daterange"
              range-separator="至"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              value-format="yyyy-MM-dd"
            />
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item>
            <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <!-- 操作按钮区域 -->
    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['system:submissions:add']"
        >新增提交</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['system:submissions:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['system:submissions:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['system:submissions:export']"
        >导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="info"
          plain
          icon="el-icon-refresh"
          size="mini"
          @click="handleRejudge"
          :disabled="multiple"
        >重新评测</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <!-- 数据表格 -->
    <el-table v-loading="loading" :data="submissionsList" @selection-change="handleSelectionChange" class="submissions-table">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="提交ID" align="center" prop="submissionId" width="80" />
      <el-table-column label="学生ID" align="center" prop="studentId" width="80" />
      <el-table-column label="OJ题目ID" align="center" prop="ojProblemId" width="100" />
      <el-table-column label="开课ID" align="center" prop="offeringId" width="80" />
      <el-table-column label="编程语言" align="center" prop="programmingLanguage" width="100">
        <template slot-scope="scope">
          <el-tag :type="getLanguageTagType(scope.row.programmingLanguage)" size="mini">
            {{ scope.row.programmingLanguage }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column label="文件名" align="center" prop="fileName" width="120" />
      <el-table-column label="提交时间" align="center" prop="submissionTime" width="160">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.submissionTime, '{y}-{m}-{d} {h}:{i}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="编译状态" align="center" prop="compileStatus" width="100">
        <template slot-scope="scope">
          <el-tag :type="getCompileStatusType(scope.row.compileStatus)" size="mini">
            {{ getCompileStatusText(scope.row.compileStatus) }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column label="执行状态" align="center" prop="executionStatus" width="100">
        <template slot-scope="scope">
          <el-tag :type="getExecutionStatusType(scope.row.executionStatus)" size="mini">
            {{ getExecutionStatusText(scope.row.executionStatus) }}
          </el-tag>
        </template>
      </el-table-column>
      <el-table-column label="最终得分" align="center" prop="finalScore" width="100">
        <template slot-scope="scope">
          <span class="score-display" :class="getScoreClass(scope.row.finalScore)">
            {{ scope.row.finalScore || '-' }}
          </span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-view"
            @click="handleView(scope.row)"
          >查看</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:submissions:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['system:submissions:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <!-- 分页组件 -->
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 新增或修改学生代码提交对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="80%" append-to-body class="submission-dialog">
      <el-form ref="form" :model="form" :rules="rules" label-width="100px">
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="学生ID" prop="studentId">
              <el-input v-model="form.studentId" placeholder="请输入学生ID" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="OJ题目ID" prop="ojProblemId">
              <el-input v-model="form.ojProblemId" placeholder="请输入OJ题目ID" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="开课ID" prop="offeringId">
              <el-input v-model="form.offeringId" placeholder="请输入开课ID" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="编程语言" prop="programmingLanguage">
              <el-select v-model="form.programmingLanguage" placeholder="请选择编程语言" style="width: 100%">
                <el-option label="C++" value="cpp"></el-option>
                <el-option label="Java" value="java"></el-option>
                <el-option label="Python" value="python"></el-option>
                <el-option label="JavaScript" value="javascript"></el-option>
                <el-option label="C" value="c"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="文件名" prop="fileName">
              <el-input v-model="form.fileName" placeholder="请输入文件名" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="提交时间" prop="submissionTime">
              <el-date-picker
                v-model="form.submissionTime"
                type="datetime"
                placeholder="请选择提交时间"
                value-format="yyyy-MM-dd HH:mm:ss"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
        </el-row>
        
        <!-- 代码编辑区域 -->
        <el-form-item label="代码内容" prop="codeContent">
          <div class="code-editor-container">
            <div class="editor-header">
              <span class="language-label">{{ form.programmingLanguage || '选择语言' }}</span>
              <div class="editor-actions">
                <el-button size="mini" @click="formatCode" :disabled="!form.codeContent">
                  <i class="el-icon-magic-stick"></i> 格式化
                </el-button>
                <el-button size="mini" @click="runTest" :disabled="!form.codeContent" type="success">
                  <i class="el-icon-video-play"></i> 运行测试
                </el-button>
              </div>
            </div>
            <div class="code-editor-wrapper">
              <editor 
                v-model="form.codeContent" 
                :min-height="400"
                class="code-editor"
              />
            </div>
          </div>
        </el-form-item>

        <!-- 评测结果区域 -->
        <el-form-item label="评测结果" v-if="evaluationResult">
          <div class="evaluation-result">
            <el-row :gutter="20">
              <el-col :span="8">
                <div class="result-item">
                  <span class="result-label">编译状态:</span>
                  <el-tag :type="evaluationResult.compileStatus === 'success' ? 'success' : 'danger'" size="small">
                    {{ getCompileStatusText(evaluationResult.compileStatus) }}
                  </el-tag>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="result-item">
                  <span class="result-label">执行状态:</span>
                  <el-tag :type="evaluationResult.executionStatus === 'success' ? 'success' : 'danger'" size="small">
                    {{ getExecutionStatusText(evaluationResult.executionStatus) }}
                  </el-tag>
                </div>
              </el-col>
              <el-col :span="8">
                <div class="result-item">
                  <span class="result-label">得分:</span>
                  <span class="score-value">{{ evaluationResult.score || 0 }}</span>
                </div>
              </el-col>
            </el-row>
            <div class="compile-message" v-if="evaluationResult.compileMessage">
              <span class="message-label">编译信息:</span>
              <pre class="message-content">{{ evaluationResult.compileMessage }}</pre>
            </div>
          </div>
        </el-form-item>

        <el-row :gutter="20">
          <el-col :span="12">
            <el-form-item label="编译信息" prop="compileMessage">
              <el-input 
                v-model="form.compileMessage" 
                type="textarea" 
                :rows="3"
                placeholder="编译信息将自动填充" 
                readonly
              />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="最终得分" prop="finalScore">
              <el-input-number 
                v-model="form.finalScore" 
                :min="0" 
                :max="100" 
                :precision="2"
                style="width: 100%"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button type="primary" @click="submitForm">确 定</el-button>
      </div>
    </el-dialog>

    <!-- 代码查看对话框 -->
    <el-dialog title="代码详情" :visible.sync="viewOpen" width="70%" append-to-body>
      <div class="code-view-container">
        <div class="code-info">
          <el-descriptions :column="3" border>
            <el-descriptions-item label="提交ID">{{ viewForm.submissionId }}</el-descriptions-item>
            <el-descriptions-item label="编程语言">
              <el-tag :type="getLanguageTagType(viewForm.programmingLanguage)" size="small">
                {{ viewForm.programmingLanguage }}
              </el-tag>
            </el-descriptions-item>
            <el-descriptions-item label="提交时间">{{ parseTime(viewForm.submissionTime) }}</el-descriptions-item>
            <el-descriptions-item label="编译状态">
              <el-tag :type="getCompileStatusType(viewForm.compileStatus)" size="small">
                {{ getCompileStatusText(viewForm.compileStatus) }}
              </el-tag>
            </el-descriptions-item>
            <el-descriptions-item label="执行状态">
              <el-tag :type="getExecutionStatusType(viewForm.executionStatus)" size="small">
                {{ getExecutionStatusText(viewForm.executionStatus) }}
              </el-tag>
            </el-descriptions-item>
            <el-descriptions-item label="最终得分">
              <span class="score-display" :class="getScoreClass(viewForm.finalScore)">
                {{ viewForm.finalScore || '-' }}
              </span>
            </el-descriptions-item>
          </el-descriptions>
        </div>
        <div class="code-content">
          <h4>代码内容:</h4>
          <pre class="code-block">{{ viewForm.codeContent }}</pre>
        </div>
        <div class="compile-info" v-if="viewForm.compileMessage">
          <h4>编译信息:</h4>
          <pre class="compile-block">{{ viewForm.compileMessage }}</pre>
        </div>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listSubmissions, getSubmissions, delSubmissions, addSubmissions, updateSubmissions } from "@/api/system/submissions"

export default {
  name: "Submissions",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 学生代码提交表格数据
      submissionsList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 是否显示查看弹出层
      viewOpen: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        studentId: null,
        ojProblemId: null,
        offeringId: null,
        programmingLanguage: null,
        fileName: null,
        submissionTime: null,
        compileStatus: null,
        executionStatus: null,
        finalScore: null
      },
      // 表单参数
      form: {},
      // 查看表单参数
      viewForm: {},
      // 表单校验
      rules: {
        studentId: [
          { required: true, message: "学生ID不能为空", trigger: "blur" }
        ],
        ojProblemId: [
          { required: true, message: "OJ题目ID不能为空", trigger: "blur" }
        ],
        codeContent: [
          { required: true, message: "代码内容不能为空", trigger: "blur" }
        ],
        programmingLanguage: [
          { required: true, message: "编程语言不能为空", trigger: "change" }
        ],
      },
      // 统计数据
      stats: {
        totalSubmissions: 156,
        acceptedSubmissions: 89,
        failedSubmissions: 67,
        avgScore: 78.5
      },
      // 评测结果
      evaluationResult: null
    }
  },
  created() {
    this.getList()
    this.getStats()
  },
  methods: {
    /** 查询学生代码提交列表 */
    getList() {
      this.loading = true
      listSubmissions(this.queryParams).then(response => {
        this.submissionsList = response.rows
        this.total = response.total
        this.loading = false
      })
    },
    /** 获取统计数据 */
    getStats() {
      // 这里可以调用统计接口，暂时使用模拟数据
      this.stats = {
        totalSubmissions: 156,
        acceptedSubmissions: 89,
        failedSubmissions: 67,
        avgScore: 78.5
      }
    },
    // 取消按钮
    cancel() {
      this.open = false
      this.reset()
      this.evaluationResult = null
    },
    // 表单重置
    reset() {
      this.form = {
        submissionId: null,
        studentId: null,
        ojProblemId: null,
        offeringId: null,
        codeContent: null,
        programmingLanguage: null,
        fileName: null,
        submissionTime: null,
        compileStatus: null,
        compileMessage: null,
        executionStatus: null,
        finalScore: null
      }
      this.resetForm("form")
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      this.handleQuery()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.submissionId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.open = true
      this.title = "添加学生代码提交"
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset()
      const submissionId = row.submissionId || this.ids
      getSubmissions(submissionId).then(response => {
        this.form = response.data
        this.open = true
        this.title = "修改学生代码提交"
      })
    },
    /** 查看按钮操作 */
    handleView(row) {
      this.viewForm = { ...row }
      this.viewOpen = true
    },
    /** 重新评测按钮操作 */
    handleRejudge() {
      const submissionIds = this.ids
      this.$modal.confirm('是否确认重新评测选中的代码提交？').then(function() {
        // 这里调用重新评测接口
        this.$modal.msgSuccess("重新评测已提交")
      }).catch(() => {})
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.submissionId != null) {
            updateSubmissions(this.form).then(response => {
              this.$modal.msgSuccess("修改成功")
              this.open = false
              this.getList()
            })
          } else {
            addSubmissions(this.form).then(response => {
              this.$modal.msgSuccess("新增成功")
              this.open = false
              this.getList()
            })
          }
        }
      })
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const submissionIds = row.submissionId || this.ids
      this.$modal.confirm('是否确认删除学生代码提交编号为"' + submissionIds + '"的数据项？').then(function() {
        return delSubmissions(submissionIds)
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("删除成功")
      }).catch(() => {})
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/submissions/export', {
        ...this.queryParams
      }, `submissions_${new Date().getTime()}.xlsx`)
    },
    /** 格式化代码 */
    formatCode() {
      // 这里可以调用代码格式化接口或使用本地格式化
      this.$modal.msgInfo("代码格式化功能开发中...")
    },
    /** 运行测试 */
    runTest() {
      // 这里调用代码评测接口
      this.loading = true
      setTimeout(() => {
        this.evaluationResult = {
          compileStatus: 'success',
          executionStatus: 'success',
          score: 85,
          compileMessage: '编译成功，无警告信息'
        }
        this.loading = false
        this.$modal.msgSuccess("测试运行完成")
      }, 2000)
    },
    /** 获取编程语言标签类型 */
    getLanguageTagType(language) {
      const typeMap = {
        'cpp': 'primary',
        'java': 'success',
        'python': 'warning',
        'javascript': 'info',
        'c': 'danger'
      }
      return typeMap[language] || 'info'
    },
    /** 获取编译状态类型 */
    getCompileStatusType(status) {
      const typeMap = {
        'success': 'success',
        'failed': 'danger',
        'compiling': 'warning'
      }
      return typeMap[status] || 'info'
    },
    /** 获取编译状态文本 */
    getCompileStatusText(status) {
      const textMap = {
        'success': '成功',
        'failed': '失败',
        'compiling': '编译中'
      }
      return textMap[status] || '未知'
    },
    /** 获取执行状态类型 */
    getExecutionStatusType(status) {
      const typeMap = {
        'success': 'success',
        'failed': 'danger',
        'running': 'warning',
        'timeout': 'danger'
      }
      return typeMap[status] || 'info'
    },
    /** 获取执行状态文本 */
    getExecutionStatusText(status) {
      const textMap = {
        'success': '成功',
        'failed': '失败',
        'running': '执行中',
        'timeout': '超时'
      }
      return textMap[status] || '未知'
    },
    /** 获取得分样式类 */
    getScoreClass(score) {
      if (!score) return ''
      if (score >= 90) return 'score-excellent'
      if (score >= 80) return 'score-good'
      if (score >= 60) return 'score-pass'
      return 'score-fail'
    }
  }
}
</script>

<style lang="scss" scoped>
.app-container {
  padding: 20px;
}

.stats-cards {
  margin-bottom: 20px;
}

.stat-card {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #409eff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
}

.stat-icon.success {
  background: #67c23a;
}

.stat-icon.warning {
  background: #e6a23c;
}

.stat-icon.info {
  background: #909399;
}

.stat-content {
  flex: 1;
}

.stat-number {
  font-size: 24px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: #606266;
}

.search-form {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.submissions-table {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.score-display {
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

.score-excellent {
  background: #f0f9ff;
  color: #67c23a;
}

.score-good {
  background: #f0f9ff;
  color: #409eff;
}

.score-pass {
  background: #fff7e6;
  color: #e6a23c;
}

.score-fail {
  background: #fef0f0;
  color: #f56c6c;
}

.submission-dialog {
  .el-dialog__body {
    padding: 20px;
  }
}

.code-editor-container {
  border: 1px solid #e4e7ed;
  border-radius: 6px;
  overflow: hidden;
}

.editor-header {
  background: #f8f9fa;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e4e7ed;
}

.language-label {
  font-weight: 600;
  color: #606266;
}

.editor-actions {
  display: flex;
  gap: 8px;
}

.code-editor-wrapper {
  padding: 16px;
}

.code-editor {
  border: none;
  outline: none;
}

.evaluation-result {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 16px;
  margin-top: 16px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.result-label {
  font-weight: 600;
  color: #606266;
  min-width: 80px;
}

.score-value {
  font-size: 18px;
  font-weight: 600;
  color: #409eff;
}

.compile-message {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e4e7ed;
}

.message-label {
  font-weight: 600;
  color: #606266;
  display: block;
  margin-bottom: 8px;
}

.message-content {
  background: white;
  border: 1px solid #e4e7ed;
  border-radius: 4px;
  padding: 12px;
  margin: 0;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #606266;
  max-height: 200px;
  overflow-y: auto;
}

.code-view-container {
  .code-info {
    margin-bottom: 20px;
  }
  
  .code-content, .compile-info {
    margin-bottom: 20px;
    
    h4 {
      margin: 0 0 12px 0;
      color: #303133;
      font-size: 16px;
    }
  }
  
  .code-block, .compile-block {
    background: #f8f9fa;
    border: 1px solid #e4e7ed;
    border-radius: 4px;
    padding: 16px;
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #606266;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
  }
}

@media (max-width: 768px) {
  .stats-cards .el-col {
    margin-bottom: 16px;
  }
  
  .search-form .el-col {
    margin-bottom: 16px;
  }
  
  .submission-dialog {
    width: 95% !important;
  }
}
</style>
